Support setting working directory of child process

This commit is contained in:
Kevin Sawicki
2013-02-11 14:53:09 -08:00
parent 2dcf607e12
commit e952a68c96
2 changed files with 20 additions and 0 deletions

View File

@@ -485,6 +485,11 @@ namespace v8_extensions {
};
}
CefRefPtr<CefV8Value> currentWorkingDirectory = options->GetValue("cwd");
if (!currentWorkingDirectory->IsUndefined() && !currentWorkingDirectory->IsNull()) {
[task setCurrentDirectoryPath:stringFromCefV8Value(currentWorkingDirectory)];
}
[task launch];
return true;

View File

@@ -127,3 +127,18 @@ describe 'Child Processes', ->
runs ->
expect(output.length).toBeGreaterThan 1
describe "when the cwd option is set", ->
it "runs the task from the specified current working directory", ->
output = []
waitsForPromise ->
options =
cwd: fixturesProject.getPath()
stdout: (data) -> output.push(data)
stderr: (data) ->
ChildProcess.exec("pwd", options)
runs ->
expect(output.join('')).toBe "#{fixturesProject.getPath()}\n"