Skip to content

Commit 87da507

Browse files
author
José Valim
committed
Use NUL instead of /dev/null on Windows
1 parent f73e6f8 commit 87da507

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

lib/elixir/lib/system.ex

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,15 @@ defmodule System do
112112
# Tries to run "git rev-parse --short HEAD". In the case of success returns
113113
# the short revision hash. If that fails, returns an empty string.
114114
defmacrop get_revision do
115-
:os.cmd('git rev-parse --short HEAD 2> /dev/null')
115+
null =
116+
case :os.type do
117+
{:win32, _} -> 'NUL'
118+
_ -> '/dev/null'
119+
end
120+
121+
'git rev-parse --short HEAD 2> '
122+
|> Kernel.++(null)
123+
|> :os.cmd()
116124
|> strip
117125
end
118126

0 commit comments

Comments
 (0)