mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 15:27:13 +03:00
scm daemon, write pid file (to be used for restart after log rotation)
Summary: write pid file Reviewed By: markbt Differential Revision: D8331445 fbshipit-source-id: 47492ffc9cc87a2ef228ce9581873dec6e01e369
This commit is contained in:
parent
63fe3fd2c3
commit
2d82868f9f
@ -17,6 +17,7 @@ use commitcloudsubscriber::{CommitCloudConfig, CommitCloudTcpReceiverService,
|
||||
CommitCloudWorkspaceSubscriberService};
|
||||
use std::fs::File;
|
||||
use std::io::Read;
|
||||
use std::io::Write;
|
||||
|
||||
/// This is what we're going to decode toml config into.
|
||||
/// Each field is optional, meaning that it doesn't have to be present in TOML.
|
||||
@ -48,9 +49,16 @@ fn run() -> Result<()> {
|
||||
.help(help)
|
||||
.args(&[
|
||||
Arg::from_usage("--config [config file (toml format)]").required(true),
|
||||
Arg::from_usage("--pidfile [specify path to pidfile]").required(false),
|
||||
])
|
||||
.get_matches();
|
||||
|
||||
// write pidfile
|
||||
// do not rely on existence of this file to check if program running
|
||||
if let Some(path) = matches.value_of("pidfile") {
|
||||
File::create(path)?.write_fmt(format_args!("{}", std::process::id()))?;
|
||||
}
|
||||
|
||||
// read required config path
|
||||
let configfile = matches.value_of("config").unwrap();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user