@@ -9,6 +9,7 @@ struct App {
9
9
mut :
10
10
report_lines []string
11
11
cached_cpuinfo map [string ]string
12
+ vexe string
12
13
}
13
14
14
15
fn (mut a App) println (s string ) {
@@ -112,11 +113,11 @@ fn (mut a App) collect_info() {
112
113
}
113
114
114
115
a.line ('' , '' )
115
- mut vexe := os. getenv ( 'VEXE' )
116
- mut vroot := os.dir (vexe)
117
- mut vmodules := os.vmodules_dir ()
118
- mut vtmp_dir := os.vtmp_dir ()
119
- mut getwd := os.getwd ()
116
+ vexe := a.vexe
117
+ vroot := os.dir (vexe)
118
+ vmodules := os.vmodules_dir ()
119
+ vtmp_dir := os.vtmp_dir ()
120
+ getwd := os.getwd ()
120
121
os.chdir (vroot) or {}
121
122
a.line ('V executable' , vexe)
122
123
a.line ('V last modified time' , time.unix (os.file_last_mod_unix (vexe)).str ())
@@ -262,7 +263,7 @@ fn (mut a App) cpu_info(key string) string {
262
263
fn (mut a App) git_info () string {
263
264
mut out := a.cmd (command: 'git -C . describe --abbrev=8 --dirty --always --tags' ).trim_space ()
264
265
os.execute ('git -C . remote add V_REPO https://github.com/vlang/v' ) // ignore failure (i.e. remote exists)
265
- os.execute ('git -C . fetch V_REPO' )
266
+ os.execute ('${os.quoted_path(a.vexe)} timeout 5.1 " git -C . fetch V_REPO"' ) // usually takes ~0.6s; 5 seconds should be enough for even the slowest networks
266
267
commit_count := a.cmd (command: 'git rev-list @{0}...V_REPO/master --right-only --count' ).int ()
267
268
if commit_count > 0 {
268
269
out + = ' (${commit_count} commit(s) behind V master)'
@@ -322,6 +323,7 @@ fn diagnose_dir(path string) string {
322
323
323
324
fn main () {
324
325
mut app := App{}
326
+ app.vexe = os.getenv ('VEXE' )
325
327
app.collect_info ()
326
328
app.report_info ()
327
329
}
0 commit comments