From d3b81486722f4b293a5359be0f7263dda877bbe6 Mon Sep 17 00:00:00 2001 From: Justin Schneck Date: Sat, 3 Feb 2018 09:56:29 -0500 Subject: [PATCH] fix nerves.system.shell for mac os --- CHANGELOG.md | 1 + lib/mix/nerves/shell.ex | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 27a120ce..e7af7f7c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ * Fix artifact archiver to use `Artifact.download_name/1` instead of `Artifact.name/1`. Fixes issues with the Docker provider and `mix nerves.artifact` + * Fix issue with `nerves.system.shell` not rendering properly ## Nerves v0.9.3 diff --git a/lib/mix/nerves/shell.ex b/lib/mix/nerves/shell.ex index 8b090c6b..2d319b79 100644 --- a/lib/mix/nerves/shell.ex +++ b/lib/mix/nerves/shell.ex @@ -9,8 +9,16 @@ defmodule Mix.Nerves.Shell do stdin_port = Port.open({:spawn, "tty_sl -c -e"}, [:binary, :eof, :stream, :in]) # We run the command through the script command to emulate a pty + cmd = + "script -q /dev/null " <> + case Nerves.Env.host_os() do + "linux" -> + "-c \"#{command}\"" + _ -> "#{command}" + end + cmd_port = - Port.open({:spawn, "script -q /dev/null -c \"#{command}\" "}, [ + Port.open({:spawn, cmd}, [ :binary, :eof, :stream,