提交 dd21e630 编写于 作者: A Andre Weinand

fix iTerm problems; fixes #4298

上级 c09bd4b2
-------------------------------------------------------------------
-- Copyright (c) Microsoft Corporation. All rights reserved.
-- Licensed under the MIT License.
-- See License.txt in the project root for license information.
-------------------------------------------------------------------
on run argv
set command to "cd \"" & argv & "\"; clear" as string
tell application "iTerm"
activate
set myterm to (current terminal)
tell myterm
tell (launch session "Default")
write text command
end tell
end tell
set done to true
end tell
end run
-------------------------------------------------------------------
-- Copyright (c) Microsoft Corporation. All rights reserved.
-- Licensed under the MIT License.
-- See License.txt in the project root for license information.
-------------------------------------------------------------------
on run argv
set command to "cd \"" & argv & "\"; clear" as string
tell application "iTerm"
activate
set theWindow to current window
if theWindow = missing value then
set theWindow to (create window with default profile)
tell theWindow
write (current session) text command
end tell
else
tell theWindow
set theTab to (create tab with default profile)
tell theTab
write (current session) text command
end tell
end tell
end if
end tell
end run
-------------------------------------------------------------------
-- Copyright (c) Microsoft Corporation. All rights reserved.
-- Licensed under the MIT License.
-- See License.txt in the project root for license information.
-------------------------------------------------------------------
on run argv
set prevDelimiter to AppleScript's text item delimiters
......
-------------------------------------------------------------------
-- Copyright (c) Microsoft Corporation. All rights reserved.
-- Licensed under the MIT License.
-- See License.txt in the project root for license information.
-------------------------------------------------------------------
on run argv
set command to "cd \"" & argv & "\"; clear" as string
......
......@@ -44,10 +44,28 @@ export class MacTerminalService implements ITerminalService {
}
return this._terminalApplicationScriptPath = new TPromise<string>((c, e) => {
let child = cp.spawn('/usr/bin/osascript', ['-e', 'exists application "iTerm"']);
let version = '';
let child = cp.spawn('/usr/bin/osascript', ['-e', 'item (((exists application "iTerm") as integer) + 1) of {0, version of application "iTerm"}']);
child.on('error', e);
child.stdout.on('data', (data) => {
version += data.toString();
});
child.on('exit', (code: number) => {
c(code === 0 ? 'iterm.scpt' : 'terminal.scpt');
let script = 'terminal.scpt';
if (code === 0) {
const match = /(\d+).(\d+).(\d+)/.exec(version);
if (match.length >= 4) {
const major = +match[1];
const minor = +match[2];
const veryMinor = +match[3];
if ((major < 2) || (major === 2 && minor < 9) || (major === 2 && minor === 9 && veryMinor < 20150414)) {
script = 'iterm.scpt';
} else {
script = 'itermNew.scpt'; // versions >= 2.9.20150414 use new script syntax
}
}
}
c(script);
});
}).then(name => uri.parse(require.toUrl(`vs/workbench/parts/execution/electron-browser/${ name }`)).fsPath);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册