Skip to content
This repository was archived by the owner on May 22, 2025. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
open config file in local EDITOR, if user is connected via SSH
  • Loading branch information
zealot128 committed Oct 6, 2017
commit b956d32b0fcedf6320fc64f652cd199422aeb315
10 changes: 9 additions & 1 deletion src/include/filesystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const fs = require('fs');
const path = require('path');
const open = require('open');
const find = require('find-in-files');
const child_process = require('child_process');

class filesystem {
static find(pattern, dir) {
Expand All @@ -22,7 +23,14 @@ class filesystem {
}

static open(file) {
if ((process.env.SSH_CLIENT || process.env.SSH_TTY) && process.env.EDITOR) {
var child = child_process.spawn(process.env.EDITOR, [file], {
stdio: 'inherit'
});
return child;
} else {
return open(file);
}
}

static join(...args) {
Expand All @@ -38,4 +46,4 @@ class filesystem {
}
}

module.exports = filesystem;
module.exports = filesystem;