title: Write to file via jenkins post-groovy script on slave
body: <p>I'd like to do something very simple: Create/write to a file located in the remote workspace of a slave via the jenkins <a href="https://wiki.jenkins-ci.org/display/JENKINS/Groovy+Postbuild+Plugin" rel="noreferrer">groovy post-build script plug-in</a></p>
  
  <pre><code>def props_file = new File(manager.build.workspace.getRemote() + "/temp/module.properties")
  
  def build_num = manager.build.buildVariables.get("MODULE_BUILD_NUMBER").toInteger()
  
  def build_props = new Properties()
  build_props["build.number"] = build_num
  
  props_file.withOutputStream { p -&gt;
      build_props.store(p, null)
  }
  </code></pre>
  
  <p>The last line fails, as the file doesn't exist. I'm thinking it has something to do with the output stream pointing to the master executor, rather than the remote workspace, but I'm not sure:</p>
  
  <pre><code>Groovy script failed:
  
  java.io.FileNotFoundException: /views/build_view/temp/module.properties (No such file or directory)
  </code></pre>
  
  <p>Am I not writing to the file correctly?</p>