mirror of
https://github.com/atom/atom.git
synced 2026-01-14 17:38:03 -05:00
Support setting working directory of child process
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user