From 84e0034168e3993493c6a8c98c84acf3f76716c2 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Wed, 23 Sep 2015 17:08:28 -0700 Subject: [PATCH] io.standard-paths.unix: iterm2 integration has some spew before every bash command if you have enabled shell integration. these commands end in ascii 7, so find the last one, strip it off, and then split on ":". Fixes the mac graphviz install problem. --- basis/io/standard-paths/unix/unix.factor | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/basis/io/standard-paths/unix/unix.factor b/basis/io/standard-paths/unix/unix.factor index bc37783b33..db3e2b9d32 100644 --- a/basis/io/standard-paths/unix/unix.factor +++ b/basis/io/standard-paths/unix/unix.factor @@ -1,16 +1,23 @@ ! Copyright (C) 2011 Doug Coleman. ! See http://factorcode.org/license.txt for BSD license. -USING: environment fry io io.encodings.utf8 io.files io.launcher -io.pathnames io.standard-paths kernel sequences splitting system ; +USING: environment fry io io.encodings.binary +io.encodings.string io.encodings.utf8 io.files io.launcher +io.pathnames io.standard-paths kernel math sequences splitting +system ; IN: io.standard-paths.unix M: unix find-in-path* [ "PATH" os-env ":" split ] dip '[ _ append-path exists? ] find nip ; +! iterm2 spews some terminal info on every bash command. +: parse-login-paths ( seq -- strings ) + dup [ 7 = ] find-last drop [ 1 + tail-slice ] when* + utf8 decode ":" split ; + : standard-login-paths ( -- strings ) { "bash" "-l" "-c" "echo $PATH" } - utf8 stream-contents ":" split ; + binary stream-contents parse-login-paths ; M: unix find-in-standard-login-path* [ standard-login-paths ] dip '[ _ append-path exists? ] find nip ;