[Issue 183] New - Shell scripts add temp file to workspace

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[Issue 183] New - Shell scripts add temp file to workspace

jglick-2
https://hudson.dev.java.net/issues/show_bug.cgi?id=183
                 Issue #|183
                 Summary|Shell scripts add temp file to workspace
               Component|hudson
                 Version|current
                Platform|All
              OS/Version|All
                     URL|
                  Status|NEW
       Status whiteboard|
                Keywords|
              Resolution|
              Issue type|DEFECT
                Priority|P3
            Subcomponent|www
             Assigned to|issues@hudson
             Reported by|jglick






------- Additional comments from [hidden email] Sat Dec  2 17:45:47 +0000 2006 -------
I found to my annoyance than when running a project which uses a shell command,
Hudson creates a hudson*sh file in the project workspace. This is not polite;
the user expects that the workspace contains just the checkout and build
products. Stray files can confuse scripts.

Shell/BatchFile call FilePath.createTempFile. At first I thought to just delete
this method and change e.g. Shell to say

File script = null;
// ...
script = File.createTempFile("hudson","sh");
script.deleteOnExit();
Writer w = new FileWriter(script);
// ...

But then I noticed the line

String[] cmd = new String[] { DESCRIPTOR.getShell(),"-xe",script.getRemote()};

I have never used slaves and so I do not know the significance of the remote
path here. Surely the hudson*sh file is not used from other machines? Can this
simply be written (with File script) as

String[] cmd = new String[] { DESCRIPTOR.getShell(),"-xe",script.getAbsolutePath()};

without breaking remote builds?

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]