Skip to content
This repository has been archived by the owner on Jun 28, 2023. It is now read-only.

Commit

Permalink
Fixes crc-org#90 adds developer terminal for macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
anjannath authored and gbraad committed Jan 25, 2022
1 parent 2a9f0fd commit 77ddb3b
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion main.js
Original file line number Diff line number Diff line change
Expand Up @@ -425,9 +425,36 @@ prepareDevTerminalForPreset = async function(preset) {

posh.unref()
}
} else if (isMac) {
var script = `tell application "Terminal"
do script "eval $(${crcBinary} ${command})"
end tell
tell application "System events"
try
set frontmost of application process "Terminal" to true
end try
end`

const scriptFileName = path.join(os.tmpdir(), 'crc-mac-terminal-script')
fs.writeFile(scriptFileName, script, (err) => {
if (err) {
showNotification({
body: "Failed to open Developer terminal" + err.message
})
} else {
const terminal = childProcess.spawn('osascript', [scriptFileName], {
detached: true,
shell: true,
stdio: 'ignore'
})

terminal.unref()
}
})
} else {
showNotification({
body: "Only supported on Windows currently"
body: "Only supported on Windows and macOS currently"
})
}
}
Expand Down

0 comments on commit 77ddb3b

Please sign in to comment.