Skip to content

Commit

Permalink
Fixed: 1) getIpcPath on MacOSX can sometimes be the same as in Linux,…
Browse files Browse the repository at this point in the history
… 2) repl(...) options is mandatory
  • Loading branch information
perak committed Dec 21, 2016
1 parent dc93b38 commit 4895354
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
18 changes: 15 additions & 3 deletions getIpcPath.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,29 @@ Gets the right IPC path
@module getIpcPath
*/

var fs = require("fs");

module.exports = function() {
var p = require('path');
var path = process.env.HOME;

if(process.platform === 'darwin')
path += '/Library/Ethereum/geth.ipc';
var macDefaultDir = "/Library/Ethereum/geth.ipc";
var linuxDefaultDir = "/.ethereum/geth.ipc";

if(process.platform === 'darwin') {
if(fs.existsSync(path + macDefaultDir))
path += macDefaultDir;
else
if(fs.existsSync(path + linuxDefaultDir))
path += linuxDefaultDir;
else
path += macDefaultDir;
}

if(process.platform === 'freebsd' ||
process.platform === 'linux' ||
process.platform === 'sunos')
path += '/.ethereum/geth.ipc';
path += linuxDefaultDir;

if(process.platform === 'win32')
path = '\\\\.\\pipe\\geth.ipc';
Expand Down
6 changes: 5 additions & 1 deletion main.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,11 @@ web3.eth.getBlockNumber(function(err, number)
else
{
console.log("Entering interactive mode.");
repl.start();
repl.start({
prompt: "> ",
input: process.stdin,
output: process.stdout
});
}
}
});
Expand Down

0 comments on commit 4895354

Please sign in to comment.