使用和不使用外壳程序运行进程之间有什么区别?

时间:2018-09-09 03:11:48

标签: node.js shell child-process

Node.js docs for child_process中,我遇到了这一行:

  

由于未生成外壳,因此不支持诸如I / O重定向和文件遍历之类的行为。

很高兴知道,但是“例如”让我担心。 还有哪些其他行为?甚至算作没有shell运行的情况-error[E0502]: cannot borrow `*mutref_s` as mutable because `mutref_s` is also borrowed as immutable --> src/main.rs:20:5 | 17 | let ref_mutref_s = &mutref_s; | -------- immutable borrow occurs here ... 20 | mutref_s.clear(); | ^^^^^^^^ mutable borrow occurs here ... 23 | } | - immutable borrow ends here / sh仍在解析命令行输入吗?

1 个答案:

答案 0 :(得分:-1)

看来我最初的假设是有缺陷的:在没有外壳的情况下调用时,Bourne外壳(componentDidMount(){ this.getItems(); const { currentUser } = firebase.auth(); this.setState({ currentUser }); } getItems = async () => { this.setState({ refreshing: true }); this.unsubscribe = await this.ref.onSnapshot((querySnapshot) => { const todos = []; querySnapshot.forEach((doc) => { todos.push({ tips: doc.data().tips, date: doc.data().date, user: doc.data().user, like: doc.data().like }) }) this.setState({ refreshing: false, getData: todos }) }) } deletePost = () => { const deleteItemId = "SELECTED DOCUEMNT ID HERE"; firestore.collection("tips").doc(deleteItemId).delete().then(function() { alert("deleted") }).catch(function(error) { alert("Error removing document: ", error); }); } renderItem = ({ item, index }) => { let date = item.date; return ( <View style={styles.tips}> <View style={styles.wrapper}> <View style={styles.profilePicture}> <View></View> </View> <View style={styles.right}> <Text style={styles.username}>@{item.user}</Text> <Text style={styles.date}>{ moment(item.date).fromNow() }</Text> </View> </View> <Text style={styles.text}>{item.tips}</Text> <View style={styles.bar}> <Text><Icon onPress={() => this.like()} style={styles.heart} type="Octicons" name="heart" /> {item.like}</Text> <Text onPress={() => { this.setModalVisible(true); }}><Icon style={styles.comment} type="FontAwesome" name="comment-o" /> {item.replies}</Text> <Text onPress={() => this.deletePost()}><Icon style={styles.settings} type="Octicons" name="kebab-vertical" /></Text> </View> </View> ) } )和Windows的sh都不分析命令-这取决于使用应用程序。 / p>

最重要的丢失功能是缺少文件名扩展。除非被调用的应用程序二进制文件了解UNIX文件语法,否则您将无法做大多数相对的文件路径技巧:

  • 父目录没有cmd.exe
  • 当前工作目录没有../
  • 用户目录没有./

不支持其他shell语法字符,例如重定向运算符(例如~)和管道(>)。

基本上,如果它在Shell的Wikipedia页面上列为功能,则非Shell执行将没有它。

相关问题