update
This commit is contained in:
+2
@@ -5,6 +5,8 @@ module.exports = {
|
||||
'/Applications/Brackets.app/Contents/MacOS/Brackets': 'brackets',
|
||||
'/Applications/Sublime Text.app/Contents/MacOS/Sublime Text':
|
||||
'/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl',
|
||||
'/Applications/Sublime Text.app/Contents/MacOS/sublime_text':
|
||||
'/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl',
|
||||
'/Applications/Sublime Text 2.app/Contents/MacOS/Sublime Text 2':
|
||||
'/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl',
|
||||
'/Applications/Sublime Text Dev.app/Contents/MacOS/Sublime Text':
|
||||
|
||||
+13
-2
@@ -13,12 +13,21 @@ module.exports = function guessEditor (specifiedEditor) {
|
||||
if (specifiedEditor) {
|
||||
return shellQuote.parse(specifiedEditor)
|
||||
}
|
||||
|
||||
if (process.versions.webcontainer) {
|
||||
return [process.env.EDITOR || 'code']
|
||||
}
|
||||
|
||||
// We can find out which editor is currently running by:
|
||||
// `ps x` on macOS and Linux
|
||||
// `Get-Process` on Windows
|
||||
try {
|
||||
if (process.platform === 'darwin') {
|
||||
const output = childProcess.execSync('ps x').toString()
|
||||
const output = childProcess
|
||||
.execSync('ps x', {
|
||||
stdio: ['pipe', 'pipe', 'ignore']
|
||||
})
|
||||
.toString()
|
||||
const processNames = Object.keys(COMMON_EDITORS_OSX)
|
||||
for (let i = 0; i < processNames.length; i++) {
|
||||
const processName = processNames[i]
|
||||
@@ -51,7 +60,9 @@ module.exports = function guessEditor (specifiedEditor) {
|
||||
// x List all processes owned by you
|
||||
// -o comm Need only names column
|
||||
const output = childProcess
|
||||
.execSync('ps x --no-heading -o comm --sort=comm')
|
||||
.execSync('ps x --no-heading -o comm --sort=comm', {
|
||||
stdio: ['pipe', 'pipe', 'ignore']
|
||||
})
|
||||
.toString()
|
||||
const processNames = Object.keys(COMMON_EDITORS_LINUX)
|
||||
for (let i = 0; i < processNames.length; i++) {
|
||||
|
||||
+3
-3
@@ -11,7 +11,7 @@
|
||||
const fs = require('fs')
|
||||
const os = require('os')
|
||||
const path = require('path')
|
||||
const chalk = require('chalk')
|
||||
const colors = require('picocolors')
|
||||
const childProcess = require('child_process')
|
||||
|
||||
const guessEditor = require('./guess')
|
||||
@@ -21,14 +21,14 @@ function wrapErrorCallback (cb) {
|
||||
return (fileName, errorMessage) => {
|
||||
console.log()
|
||||
console.log(
|
||||
chalk.red('Could not open ' + path.basename(fileName) + ' in the editor.')
|
||||
colors.red('Could not open ' + path.basename(fileName) + ' in the editor.')
|
||||
)
|
||||
if (errorMessage) {
|
||||
if (errorMessage[errorMessage.length - 1] !== '.') {
|
||||
errorMessage += '.'
|
||||
}
|
||||
console.log(
|
||||
chalk.red('The editor process exited with an error: ' + errorMessage)
|
||||
colors.red('The editor process exited with an error: ' + errorMessage)
|
||||
)
|
||||
}
|
||||
console.log()
|
||||
|
||||
+13
-13
@@ -1,32 +1,32 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"launch-editor@2.2.1",
|
||||
"/mnt/Foxconn/Digitalent/Deverloper/liff-push_2series"
|
||||
"launch-editor@2.4.0",
|
||||
"/home/node/nuxt"
|
||||
]
|
||||
],
|
||||
"_from": "launch-editor@2.2.1",
|
||||
"_id": "launch-editor@2.2.1",
|
||||
"_from": "launch-editor@2.4.0",
|
||||
"_id": "launch-editor@2.4.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-On+V7K2uZK6wK7x691ycSUbLD/FyKKelArkbaAMSSJU8JmqmhwN2+mnJDNINuJWSrh2L0kDk+ZQtbC/gOWUwLw==",
|
||||
"_integrity": "sha512-mZ0BHeSn/ohL+Ib+b+JnxC59vcNz6v5IR9d0CuM8f0x8ni8oK3IIG6G0vMkpxc0gFsmvINkztGOHiWTaX4BmAg==",
|
||||
"_location": "/launch-editor",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "launch-editor@2.2.1",
|
||||
"raw": "launch-editor@2.4.0",
|
||||
"name": "launch-editor",
|
||||
"escapedName": "launch-editor",
|
||||
"rawSpec": "2.2.1",
|
||||
"rawSpec": "2.4.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "2.2.1"
|
||||
"fetchSpec": "2.4.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/launch-editor-middleware"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/launch-editor/-/launch-editor-2.2.1.tgz",
|
||||
"_spec": "2.2.1",
|
||||
"_where": "/mnt/Foxconn/Digitalent/Deverloper/liff-push_2series",
|
||||
"_resolved": "https://registry.npmjs.org/launch-editor/-/launch-editor-2.4.0.tgz",
|
||||
"_spec": "2.4.0",
|
||||
"_where": "/home/node/nuxt",
|
||||
"author": {
|
||||
"name": "Evan You"
|
||||
},
|
||||
@@ -34,7 +34,7 @@
|
||||
"url": "https://github.com/yyx990803/launch-editor/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"chalk": "^2.3.0",
|
||||
"picocolors": "^1.0.0",
|
||||
"shell-quote": "^1.6.1"
|
||||
},
|
||||
"description": "launch editor from node.js",
|
||||
@@ -50,5 +50,5 @@
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/yyx990803/launch-editor.git"
|
||||
},
|
||||
"version": "2.2.1"
|
||||
"version": "2.4.0"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user