mirror of
https://github.com/notohh/rustlings.git
synced 2024-11-25 06:57:31 -05:00
Try to run git init
This commit is contained in:
parent
212c82c6f6
commit
6d1d42d2dd
1 changed files with 10 additions and 1 deletions
11
src/init.rs
11
src/init.rs
|
@ -4,6 +4,7 @@ use std::{
|
||||||
fs::{self, create_dir},
|
fs::{self, create_dir},
|
||||||
io::ErrorKind,
|
io::ErrorKind,
|
||||||
path::Path,
|
path::Path,
|
||||||
|
process::{Command, Stdio},
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::{cargo_toml::updated_cargo_toml, embedded::EMBEDDED_FILES, info_file::InfoFile};
|
use crate::{cargo_toml::updated_cargo_toml, embedded::EMBEDDED_FILES, info_file::InfoFile};
|
||||||
|
@ -50,6 +51,13 @@ pub fn init() -> Result<()> {
|
||||||
fs::write(".vscode/extensions.json", VS_CODE_EXTENSIONS_JSON)
|
fs::write(".vscode/extensions.json", VS_CODE_EXTENSIONS_JSON)
|
||||||
.context("Failed to create the file `rustlings/.vscode/extensions.json`")?;
|
.context("Failed to create the file `rustlings/.vscode/extensions.json`")?;
|
||||||
|
|
||||||
|
// Ignore any Git error because Git initialization is not required.
|
||||||
|
let _ = Command::new("git")
|
||||||
|
.arg("init")
|
||||||
|
.stdin(Stdio::null())
|
||||||
|
.stderr(Stdio::null())
|
||||||
|
.status();
|
||||||
|
|
||||||
println!("{POST_INIT_MSG}");
|
println!("{POST_INIT_MSG}");
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
@ -76,7 +84,8 @@ You probably already initialized Rustlings.
|
||||||
Run `cd rustlings`
|
Run `cd rustlings`
|
||||||
Then run `rustlings` again";
|
Then run `rustlings` again";
|
||||||
|
|
||||||
const POST_INIT_MSG: &str = "Done initialization!
|
const POST_INIT_MSG: &str = "
|
||||||
|
Done initialization!
|
||||||
|
|
||||||
Run `cd rustlings` to go into the generated directory.
|
Run `cd rustlings` to go into the generated directory.
|
||||||
Then run `rustlings` to get started.";
|
Then run `rustlings` to get started.";
|
||||||
|
|
Loading…
Reference in a new issue