Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
Breeze
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DeStream-public
Breeze
Commits
55a2b35e
Commit
55a2b35e
authored
Sep 26, 2017
by
dev0tion
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Spawn two daemon processes on start
parent
e9cc5ff7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
67 additions
and
22 deletions
+67
-22
main.ts
Breeze.UI/main.ts
+67
-22
No files found.
Breeze.UI/main.ts
View file @
55a2b35e
...
...
@@ -61,22 +61,10 @@ function createWindow() {
// Emitted when the window is going to close.
mainWindow
.
on
(
'close'
,
function
()
{
if
(
process
.
platform
!==
'darwin'
&&
!
serve
)
{
var
http
=
require
(
'http'
);
const
options
=
{
hostname
:
'localhost'
,
port
:
5000
,
path
:
'/api/node/shutdown'
,
method
:
'POST'
};
const
req
=
http
.
request
(
options
,
(
res
)
=>
{});
req
.
write
(
''
);
req
.
end
();
}
}
);
}
closeBitcoinApi
(),
closeStratisApi
();
})
};
// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
...
...
@@ -86,7 +74,8 @@ app.on('ready', function () {
console
.
log
(
"Breeze UI was started in development mode. This requires the user to be running the Breeze Daemon himself."
)
}
else
{
startApi
();
startBitcoinApi
();
startStratisApi
();
}
createTray
();
createWindow
();
...
...
@@ -113,17 +102,73 @@ app.on('activate', function () {
}
});
function
startApi
()
{
var
apiProcess
;
const
exec
=
require
(
'child_process'
).
exec
;
function
closeBitcoinApi
()
{
if
(
process
.
platform
!==
'darwin'
&&
!
serve
)
{
var
http1
=
require
(
'http'
);
const
options1
=
{
hostname
:
'localhost'
,
port
:
5000
,
path
:
'/api/node/shutdown'
,
method
:
'POST'
};
const
req
=
http1
.
request
(
options1
,
(
res
)
=>
{});
req
.
write
(
''
);
req
.
end
();
}
};
function
closeStratisApi
()
{
if
(
process
.
platform
!==
'darwin'
&&
!
serve
)
{
var
http2
=
require
(
'http'
);
const
options2
=
{
hostname
:
'localhost'
,
port
:
5105
,
path
:
'/api/node/shutdown'
,
method
:
'POST'
};
const
req
=
http2
.
request
(
options2
,
(
res
)
=>
{});
req
.
write
(
''
);
req
.
end
();
}
};
function
startBitcoinApi
()
{
var
bitcoinProcess
;
const
execBitcoin
=
require
(
'child_process'
).
exec
;
//Start Breeze Bitcoin Daemon
let
apiPath
=
path
.
join
(
__dirname
,
'".//assets//daemon//Breeze.Daemon"'
);
if
(
os
.
platform
()
===
'win32'
)
{
apiPath
=
path
.
join
(
__dirname
,
'".
\\
assets
\\
daemon
\\
Breeze.Daemon.exe"'
);
}
bitcoinProcess
=
execBitcoin
(
'"'
+
apiPath
+
'" light -testnet'
,
{
detached
:
true
},
(
error
,
stdout
,
stderr
)
=>
{
if
(
error
)
{
writeLogError
(
`exec error:
${
error
}
`
);
return
;
}
if
(
serve
)
{
writeLog
(
`stdout:
${
stdout
}
`
);
writeLog
(
`stderr:
${
stderr
}
`
);
}
});
}
function
startStratisApi
()
{
var
stratisProcess
;
const
execStratis
=
require
(
'child_process'
).
exec
;
//Start Breeze Daemon
//Start Breeze
Stratis
Daemon
let
apiPath
=
path
.
join
(
__dirname
,
'".//assets//daemon//Breeze.Daemon"'
);
if
(
os
.
platform
()
===
'win32'
)
{
apiPath
=
path
.
join
(
__dirname
,
'".
\\
assets
\\
daemon
\\
Breeze.Daemon.exe"'
);
}
apiProcess
=
exec
(
'"'
+
apiPath
+
'"
light -testnet'
,
{
stratisProcess
=
execStratis
(
'"'
+
apiPath
+
'" stratis
light -testnet'
,
{
detached
:
true
},
(
error
,
stdout
,
stderr
)
=>
{
if
(
error
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment