项目作者: astares

项目描述 :
高级语言: Smalltalk
项目地址: git://github.com/astares/Pharo-OS-Unix.git
创建时间: 2018-07-04T07:05:44Z
项目社区:https://github.com/astares/Pharo-OS-Unix

开源协议:

下载


Pharo-OS-Unix

Introduction

This is a Pharo package written by Torsten Bergmann (astares) to get better support for Unix systems into Pharo.

Unit Tests
Coverage Status

Pharo 7
Pharo 8
Pharo 9
Pharo 10
Pharo 11

Quick Start

Installation

  1. Metacello new
  2. repository: 'github://astares/Pharo-OS-Unix/src';
  3. baseline: 'OSUnix';
  4. load

The package can be loaded from Pharo catalog. Just open the Catalog and search for “OSUnix”. It is useful to use this package with Pharo on Unix including Linux derivates and Mac.

Documentation

After loading the package you have several classes that you can use like UNIXEnvironment or UNIXProcess

Working with external UNIX commands

With the help of the UNIXProcess class you have access to external commands. For example inspect the result of the following command.

  1. UNIXProcess resultOfCommand: 'ls'

Sometimes it is useful to run a command with super user rights. So while

  1. UNIXProcess resultOfCommand: 'whoami'

would run with the regular user rights of the Pharo process owner (and return the current user) you can use
the method #resultOfCommand:whenRunningAsRootUsingPassword: to run a process with administrative rights:

  1. UNIXProcess resultOfCommand: 'whoami' whenRunningAsRootUsingPassword: 'myrootpassword'

This should give you the ‘root’.

Working with UNIX user management

Within the OS-Unix-Environment package you will find classes to help with the Unix security.

  1. UNIXUser allUsers

or

  1. UNIXGroup allGroups

Browsing UNIX man pages in Pharo

When the package is loaded it is possible to open the Pharo spotter and enter a unix command. If there is a UNIX man page then Pharo will display it and you can directly show it within the Pharo environment.

History

Migrated from http://smalltalkhub.com/#!/~OS/OS-Unix