Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minimal Windows support for Process #9047

Merged
merged 18 commits into from
Apr 14, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions spec/std/process_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,11 @@ describe Process do

it "redirects output to /dev/null" do
# This doesn't test anything but no output should be seen while running tests
if {{flag?(:win32)}}
command = "cmd.exe"
args = {"/c", "dir"}
else
command = "/bin/ls"
args = [] of String
end
command, args = {% if flag?(:win32) %}
{"cmd.exe", {"/c", "dir"}}
{% else %}
{"/bin/ls", [] of String}
{% end %}
Process.run(command, args, output: Process::Redirect::Close).exit_code.should eq(0)
end

Expand Down Expand Up @@ -155,7 +153,11 @@ describe Process do

it "sets working directory" do
parent = File.dirname(Dir.current)
command = {{flag?(:win32)}} ? "cmd /c echo %cd%" : "pwd"
command = {% if flag?(:win32) %}
"cmd /c echo %cd%"
oprypin marked this conversation as resolved.
Show resolved Hide resolved
{% else %}
"pwd"
{% end %}
value = Process.run(command, shell: true, chdir: parent, output: Process::Redirect::Pipe) do |proc|
proc.output.gets_to_end
end
Expand Down